JMS Selectors and Filtering
This page contains more detailed information on the use of the JMS Selector and filtering when requesting a subscription from the Local Actor API. The JMS Selector is used to subscribe on certain capabilities of the data available on AMQP, where filtering can be done on the header fields of the AMQP. The capabilities for which a JMS Selector can be created are fixed for all messages and are described in following table.
Overview of JMS Selectors
| Selector | Description | Example(s) | Possible values |
|---|---|---|---|
| dtapEnvironment | The environment of the MI to subscribe to | "dtapEnvironment='acceptance'", "dtapEnvironment='production'" |
|
| protocolVersion | This field indicates the message type and which version. This can be used to susbcribe to a set version of a message type | "protocolVersion='DENM:1.3.1'", "protocolVersion='IVIM:1.2.1'" |
|
| messageType | The message type to subscribe to, ignoring the version | "messageType='DENM'", "messageType='SPATEM'" |
|
| quadTree | Filter on geographic region, described by quadkey list | "quadTree LIKE '%,12020123223210,%'" | |
| For multiple quadkeys the selector has to be repeated | "(quadTree LIKE '%,12020123223210,%') OR (quadTree LIKE '%,12020123223212,%')" | ||
| custom-mobilidata-useCase | Selector to subscribe on specific Mobilidata DENM use cases | "\"custom-mobilidata-useCase\" LIKE '%,4,%'" | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 25 |
| For multiple use case subscriptions the selector has to be repeated | "(\"custom-mobilidata-useCase\" LIKE '%,4,%') OR (\"custom-mobilidata-useCase\" LIKE '%,5,%' )" | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 25 | |
| publisherId | The PIP which put the message on the MI | "publisherId='BE00004'" | |
| originatingCountry | The country which the message corresponds to | "originatingCountry='BE'" | |
| publicationId | PIP publication id | "publicationId='BE00004:DENM_ACC_ACCIDENT_BREAKDOWN_01'" |
The field "custom-mobilidata-useCase" must be delimited when used in the selector (since it contains a hyphen)
Filtering
The MI allows a more fine-grained filtering when connecting to the AMQP service. These are based on the default AMQP Apache-filters. This filtering allows to subscribe on specific header field of the AMQP messages. Not all header fields are part of the capabilities, so not all fields can be added in the JMS Selector. This filtering allows the remaining fields to be added as a filter.
Example snippet in Go-lang for filtering on specific causeCode and subCauseCode. The format is similar to the JMS Selectors when filtering on multiple fields.
filter := amqp.NewSelectorFilter("causeCode=95 AND subCauseCode=0")
receiver, err = session.NewReceiver(context.Background(), endpoint.Source, &amqp.ReceiverOptions{ Filters: []amqp.LinkFilter{filter} })